//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.founder.chd_daily_query.service.impl;

import com.founder.chd_daily_query.entity.query.LandCoalDemandplanEntity;
import com.founder.chd_daily_query.entity.query.LandCoalPurchasingplanEntity;
import com.founder.chd_daily_query.entity.query.LandCoalSendplanEntity;
import com.founder.chd_daily_query.entity.query.LandCoalSettleEntity;
import com.founder.chd_daily_query.entity.query.WaterCoalDemandplanEntity;
import com.founder.chd_daily_query.entity.query.WaterCoalPurchasingplanEntity;
import com.founder.chd_daily_query.entity.query.WaterCoalSendplanEntity;
import com.founder.chd_daily_query.entity.query.WaterCoalSettleEntity;
import com.founder.chd_daily_query.entity.query.WinBidPriceEntity;
import com.founder.chd_daily_query.repo.query.LandCoalDemandplanRepo;
import com.founder.chd_daily_query.repo.query.LandCoalPurchasingplanRepo;
import com.founder.chd_daily_query.repo.query.LandCoalSendplanRepo;
import com.founder.chd_daily_query.repo.query.LandCoalSettleRepo;
import com.founder.chd_daily_query.repo.query.WaterCoalDemandplanRepo;
import com.founder.chd_daily_query.repo.query.WaterCoalPurchasingplanRepo;
import com.founder.chd_daily_query.repo.query.WaterCoalSendplanRepo;
import com.founder.chd_daily_query.repo.query.WaterCoalSettleRepo;
import com.founder.chd_daily_query.repo.query.WinBidPriceRepo;
import com.founder.chd_daily_query.service.TraceService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

@Service
public class TraceServiceImpl implements TraceService {
    @Autowired
    LandCoalDemandplanRepo landCoalDemandplanRepo;
    @Autowired
    WaterCoalDemandplanRepo waterCoalDemandplanRepo;
    @Autowired
    LandCoalSendplanRepo landCoalSendplanRepo;
    @Autowired
    WaterCoalSendplanRepo waterCoalSendplanRepo;
    @Autowired
    WinBidPriceRepo winBidPriceRepo;
    @Autowired
    LandCoalPurchasingplanRepo landCoalPurchasingplanRepo;
    @Autowired
    WaterCoalPurchasingplanRepo waterCoalPurchasingplanRepo;
    @Autowired
    LandCoalSettleRepo landCoalSettleRepo;
    @Autowired
    WaterCoalSettleRepo waterCoalSettleRepo;
    Map<String, Object> res;
    List<Object> demandPlan;
    List<Object> sendPlan;
    List<Object> bid;
    List<Object> purchasePlan;
    List<Object> contract;
    boolean flag;

    public TraceServiceImpl() {
        this.sendPlan=new ArrayList<>();
        this.demandPlan =new ArrayList<>();
        this.purchasePlan =new ArrayList<>();
        this.contract=new ArrayList<>();
        this.bid=new ArrayList<>();
    }

    public synchronized Map<String, List<Object>> getDetail(String demand) {
        this.demandPlan = new ArrayList();
        this.sendPlan = new ArrayList();
        this.bid = new ArrayList();
        this.purchasePlan = new ArrayList();
        this.contract = new ArrayList();
        this.res = new HashMap();
        this.tracer(demand);
        Map<String, List<Object>> res = new HashMap();
        res.put("demandPlan", this.demandPlan);
        res.put("sendPlan", this.sendPlan);
        res.put("bid", this.bid);
        res.put("purchasePlan", this.purchasePlan);
        res.put("contract", this.contract);
        return res;
    }

    @Override
    public Object tracerViaContractId(String contractCode) {
        WaterCoalPurchasingplanEntity waterCoalPurchasingplanEntity = new WaterCoalPurchasingplanEntity();
        LandCoalPurchasingplanEntity landCoalPurchasingplanEntity = new LandCoalPurchasingplanEntity();
        waterCoalPurchasingplanEntity.setContractCode(contractCode);
        landCoalPurchasingplanEntity.setContractCode(contractCode);
        Example<LandCoalPurchasingplanEntity> of = Example.of(landCoalPurchasingplanEntity);
        Example<WaterCoalPurchasingplanEntity> of3 = Example.of(waterCoalPurchasingplanEntity);
        //是个陆运方案
        if(landCoalPurchasingplanRepo.findAll(of).size()!=0){
            LandCoalPurchasingplanEntity landCoalPurchasingplanEntity1 = landCoalPurchasingplanRepo.findAll(of).get(0);
            String purchaseSalePreceptId = landCoalPurchasingplanEntity1.getPurchaseSalePreceptId();
            WinBidPriceEntity winBidPriceEntity = new WinBidPriceEntity();
            winBidPriceEntity.setPurchaseSalePreceptId(purchaseSalePreceptId);

            Example<WinBidPriceEntity> of1 = Example.of(winBidPriceEntity);

            List<WinBidPriceEntity> all = winBidPriceRepo.findAll(of1);
            if(all.size()==0){
                //找不到关联竞价
                return null;
            }
            else{
                //目标竞价
                WinBidPriceEntity winBidPriceEntity1 = all.get(0);
                String purchaseSalePlanId = winBidPriceEntity1.getPurchaseSalePlanId();

                LandCoalSendplanEntity landCoalSendplanEntity = new LandCoalSendplanEntity();
                landCoalSendplanEntity.setPurchaseSalePlanId(purchaseSalePlanId);
                Example<LandCoalSendplanEntity> of2 = Example.of(landCoalSendplanEntity);
                List<LandCoalSendplanEntity> all1 = landCoalSendplanRepo.findAll(of2);
                if(all1.size()==0){
                    return null;
                }else{
                    LandCoalSendplanEntity landCoalSendplanEntity1 = all1.get(0);
                    String demandSupplierId = landCoalSendplanEntity1.getDemandSupplierId();

                    return tracer(demandSupplierId);
                }
            }
        }
        else if(waterCoalPurchasingplanRepo.findAll(of3).size()!=0){
            WaterCoalPurchasingplanEntity waterCoalPurchasingplanEntity1 = waterCoalPurchasingplanRepo.findAll(of3).get(0);
            String purchaseSalePreceptId = waterCoalPurchasingplanEntity1.getPurchaseSalePreceptId();
            WinBidPriceEntity winBidPriceEntity = new WinBidPriceEntity();
            winBidPriceEntity.setPurchaseSalePreceptId(purchaseSalePreceptId);

            Example<WinBidPriceEntity> of1 = Example.of(winBidPriceEntity);

            List<WinBidPriceEntity> all = winBidPriceRepo.findAll(of1);
            if(all.size()==0){
                //找不到关联竞价
                return null;
            }
            else{
                //目标竞价
                WinBidPriceEntity winBidPriceEntity1 = all.get(0);
                String purchaseSalePlanId = winBidPriceEntity1.getPurchaseSalePlanId();

                WaterCoalSendplanEntity waterCoalSendplanEntity = new WaterCoalSendplanEntity();
                waterCoalSendplanEntity.setPurchaseSalePlanId(purchaseSalePlanId);
                Example<WaterCoalSendplanEntity> of2 = Example.of(waterCoalSendplanEntity);
                List<WaterCoalSendplanEntity> all1 = waterCoalSendplanRepo.findAll(of2);
                if(all1.size()==0){
                    return null;
                }else{
                    WaterCoalSendplanEntity waterCoalSendplanEntity1 = all1.get(0);
                    String demandSupplierId = waterCoalSendplanEntity1.getDemandSupplierId();

                    return tracer(demandSupplierId);
                }
            }
        }

        return null;
    }

    @Override
    public Map<String, List<Object>> getDetailViaContractId(String contractCode) {
        WaterCoalPurchasingplanEntity waterCoalPurchasingplanEntity = new WaterCoalPurchasingplanEntity();
        LandCoalPurchasingplanEntity landCoalPurchasingplanEntity = new LandCoalPurchasingplanEntity();
        waterCoalPurchasingplanEntity.setContractCode(contractCode);
        landCoalPurchasingplanEntity.setContractCode(contractCode);
        Example<LandCoalPurchasingplanEntity> of = Example.of(landCoalPurchasingplanEntity);
        Example<WaterCoalPurchasingplanEntity> of3 = Example.of(waterCoalPurchasingplanEntity);
        //是个陆运方案
        if(landCoalPurchasingplanRepo.findAll(of).size()!=0){
            LandCoalPurchasingplanEntity landCoalPurchasingplanEntity1 = landCoalPurchasingplanRepo.findAll(of).get(0);
            String purchaseSalePreceptId = landCoalPurchasingplanEntity1.getPurchaseSalePreceptId();
            WinBidPriceEntity winBidPriceEntity = new WinBidPriceEntity();
            winBidPriceEntity.setPurchaseSalePreceptId(purchaseSalePreceptId);

            Example<WinBidPriceEntity> of1 = Example.of(winBidPriceEntity);

            List<WinBidPriceEntity> all = winBidPriceRepo.findAll(of1);
            if(all.size()==0){
                //找不到关联竞价
                return null;
            }
            else{
                //目标竞价
                WinBidPriceEntity winBidPriceEntity1 = all.get(0);
                String purchaseSalePlanId = winBidPriceEntity1.getPurchaseSalePlanId();

                LandCoalSendplanEntity landCoalSendplanEntity = new LandCoalSendplanEntity();
                landCoalSendplanEntity.setPurchaseSalePlanId(purchaseSalePlanId);
                Example<LandCoalSendplanEntity> of2 = Example.of(landCoalSendplanEntity);
                List<LandCoalSendplanEntity> all1 = landCoalSendplanRepo.findAll(of2);
                if(all1.size()==0){
                    return null;
                }else{
                    LandCoalSendplanEntity landCoalSendplanEntity1 = all1.get(0);
                    String demandSupplierId = landCoalSendplanEntity1.getDemandSupplierId();

                    this.demandPlan = new ArrayList();
                    this.sendPlan = new ArrayList();
                    this.bid = new ArrayList();
                    this.purchasePlan = new ArrayList();
                    this.contract = new ArrayList();
                    this.res = new HashMap();
                    this.tracer(demandSupplierId);
                    Map<String, List<Object>> res = new HashMap();
                    res.put("demandPlan", this.demandPlan);
                    res.put("sendPlan", this.sendPlan);
                    res.put("bid", this.bid);
                    res.put("purchasePlan", this.purchasePlan);
                    res.put("contract", this.contract);
                    return res;

                }
            }
        }
        else if(waterCoalPurchasingplanRepo.findAll(of3).size()!=0){
            WaterCoalPurchasingplanEntity waterCoalPurchasingplanEntity1 = waterCoalPurchasingplanRepo.findAll(of3).get(0);
            String purchaseSalePreceptId = waterCoalPurchasingplanEntity1.getPurchaseSalePreceptId();
            WinBidPriceEntity winBidPriceEntity = new WinBidPriceEntity();
            winBidPriceEntity.setPurchaseSalePreceptId(purchaseSalePreceptId);

            Example<WinBidPriceEntity> of1 = Example.of(winBidPriceEntity);

            List<WinBidPriceEntity> all = winBidPriceRepo.findAll(of1);
            if(all.size()==0){
                //找不到关联竞价
                return null;
            }
            else{
                //目标竞价
                WinBidPriceEntity winBidPriceEntity1 = all.get(0);
                String purchaseSalePlanId = winBidPriceEntity1.getPurchaseSalePlanId();

                WaterCoalSendplanEntity waterCoalSendplanEntity = new WaterCoalSendplanEntity();
                waterCoalSendplanEntity.setPurchaseSalePlanId(purchaseSalePlanId);
                Example<WaterCoalSendplanEntity> of2 = Example.of(waterCoalSendplanEntity);
                List<WaterCoalSendplanEntity> all1 = waterCoalSendplanRepo.findAll(of2);
                if(all1.size()==0){
                    return null;
                }else{
                    WaterCoalSendplanEntity waterCoalSendplanEntity1 = all1.get(0);
                    String demandSupplierId = waterCoalSendplanEntity1.getDemandSupplierId();

                    this.demandPlan = new ArrayList();
                    this.sendPlan = new ArrayList();
                    this.bid = new ArrayList();
                    this.purchasePlan = new ArrayList();
                    this.contract = new ArrayList();
                    this.res = new HashMap();
                    this.tracer(demandSupplierId);
                    Map<String, List<Object>> res = new HashMap();
                    res.put("demandPlan", this.demandPlan);
                    res.put("sendPlan", this.sendPlan);
                    res.put("bid", this.bid);
                    res.put("purchasePlan", this.purchasePlan);
                    res.put("contract", this.contract);
                    return res;
                }
            }
        }

        return null;
    }

    @Override
    public Object tracerViaBidId(String bidCode) {
        WinBidPriceEntity winBidPriceEntity = new WinBidPriceEntity();
        winBidPriceEntity.setBidCode(bidCode);
        Example<WinBidPriceEntity> of1 = Example.of(winBidPriceEntity);
        List<WinBidPriceEntity> all = winBidPriceRepo.findAll(of1);
        if(all.size()==0){
            return null;
        }

        WinBidPriceEntity winBidPriceEntity1 = all.get(0);
        String purchaseSalePlanId = winBidPriceEntity1.getPurchaseSalePlanId();

        LandCoalSendplanEntity landCoalSendplanEntity = new LandCoalSendplanEntity();
        landCoalSendplanEntity.setPurchaseSalePlanId(purchaseSalePlanId);
        Example<LandCoalSendplanEntity> of2 = Example.of(landCoalSendplanEntity);
        List<LandCoalSendplanEntity> all1 = landCoalSendplanRepo.findAll(of2);


        WaterCoalSendplanEntity waterCoalSendplanEntity = new WaterCoalSendplanEntity();
        waterCoalSendplanEntity.setPurchaseSalePlanId(purchaseSalePlanId);
        Example<WaterCoalSendplanEntity> of3 = Example.of(waterCoalSendplanEntity);
        List<WaterCoalSendplanEntity> all2 = waterCoalSendplanRepo.findAll(of3);

        //是个陆运方案
        if(all1.size()!=0) {

            LandCoalSendplanEntity landCoalSendplanEntity1 = all1.get(0);
            String demandSupplierId = landCoalSendplanEntity1.getDemandSupplierId();
            return tracer(demandSupplierId);


        }
        else if(all2.size()!=0){

                    WaterCoalSendplanEntity waterCoalSendplanEntity1 = all2.get(0);
                    String demandSupplierId = waterCoalSendplanEntity1.getDemandSupplierId();

                   return tracer(demandSupplierId);
                }



        return null;
    }

    @Override
    public Map<String, List<Object>> getDetailViaBidId(String bidCode) {
        WinBidPriceEntity winBidPriceEntity = new WinBidPriceEntity();
        winBidPriceEntity.setBidCode(bidCode);
        Example<WinBidPriceEntity> of1 = Example.of(winBidPriceEntity);
        List<WinBidPriceEntity> all = winBidPriceRepo.findAll(of1);
        if(all.size()==0){
            return null;
        }

        WinBidPriceEntity winBidPriceEntity1 = all.get(0);
        String purchaseSalePlanId = winBidPriceEntity1.getPurchaseSalePlanId();

        LandCoalSendplanEntity landCoalSendplanEntity = new LandCoalSendplanEntity();
        landCoalSendplanEntity.setPurchaseSalePlanId(purchaseSalePlanId);
        Example<LandCoalSendplanEntity> of2 = Example.of(landCoalSendplanEntity);
        List<LandCoalSendplanEntity> all1 = landCoalSendplanRepo.findAll(of2);


        WaterCoalSendplanEntity waterCoalSendplanEntity = new WaterCoalSendplanEntity();
        waterCoalSendplanEntity.setPurchaseSalePlanId(purchaseSalePlanId);
        Example<WaterCoalSendplanEntity> of3 = Example.of(waterCoalSendplanEntity);
        List<WaterCoalSendplanEntity> all2 = waterCoalSendplanRepo.findAll(of3);

        //是个陆运方案
        if(all1.size()!=0) {

            LandCoalSendplanEntity landCoalSendplanEntity1 = all1.get(0);
            String demandSupplierId = landCoalSendplanEntity1.getDemandSupplierId();

            this.demandPlan = new ArrayList();
            this.sendPlan = new ArrayList();
            this.bid = new ArrayList();
            this.purchasePlan = new ArrayList();
            this.contract = new ArrayList();
            this.res = new HashMap();
            this.tracer(demandSupplierId);
            Map<String, List<Object>> res = new HashMap();
            res.put("demandPlan", this.demandPlan);
            res.put("sendPlan", this.sendPlan);
            res.put("bid", this.bid);
            res.put("purchasePlan", this.purchasePlan);
            res.put("contract", this.contract);
            return res;


        }
        else if(all2.size()!=0){

            WaterCoalSendplanEntity waterCoalSendplanEntity1 = all2.get(0);
            String demandSupplierId = waterCoalSendplanEntity1.getDemandSupplierId();

            this.demandPlan = new ArrayList();
            this.sendPlan = new ArrayList();
            this.bid = new ArrayList();
            this.purchasePlan = new ArrayList();
            this.contract = new ArrayList();
            this.res = new HashMap();
            this.tracer(demandSupplierId);
            Map<String, List<Object>> res = new HashMap();
            res.put("demandPlan", this.demandPlan);
            res.put("sendPlan", this.sendPlan);
            res.put("bid", this.bid);
            res.put("purchasePlan", this.purchasePlan);
            res.put("contract", this.contract);
            return res;
        }



        return null;
    }

    @Override


    public synchronized Object tracer(String demand) {
        this.res = new HashMap();
        LandCoalDemandplanEntity landCoalDemandplanEntity = new LandCoalDemandplanEntity();
        landCoalDemandplanEntity.setDemandSupplierId(demand);
        Example<LandCoalDemandplanEntity> of = Example.of(landCoalDemandplanEntity);
        List<LandCoalDemandplanEntity> all = this.landCoalDemandplanRepo.findAll(of);
        if (all.size() == 0) {
            WaterCoalDemandplanEntity waterCoalDemandplanEntity = new WaterCoalDemandplanEntity();
            waterCoalDemandplanEntity.setDemandSupplierId(demand);
            Example<WaterCoalDemandplanEntity> of1 = Example.of(waterCoalDemandplanEntity);
            List<WaterCoalDemandplanEntity> all1 = this.waterCoalDemandplanRepo.findAll(of1);
            if (all1.size() == 0) {
                return null;
            } else {
                this.waterTracerDemand(demand);
                return this.res;
            }
        } else {
            this.landTracerDemand(demand);
            return this.res;
        }
    }

    private void landTracerDemand(String value) {
        LandCoalDemandplanEntity landCoalDemandplanEntity = new LandCoalDemandplanEntity();
        landCoalDemandplanEntity.setDemandSupplierId(value);
        Example<LandCoalDemandplanEntity> of = Example.of(landCoalDemandplanEntity);
        List<LandCoalDemandplanEntity> all = this.landCoalDemandplanRepo.findAll(of);
        LandCoalDemandplanEntity sample = (LandCoalDemandplanEntity)all.get(0);
        this.res.put("name", "陆运煤需求计划:" + sample.getDemandSupplierId());
        this.res.put("value", "需求标煤单价：" + sample.getStandardCoalUnitprice());
        this.demandPlan.add(sample);
        this.res.put("children", this.landTracerSend(value));
    }

    private List<Map> landTracerSend(String value) {
        LandCoalSendplanEntity landCoalSendplanEntity = new LandCoalSendplanEntity();
        landCoalSendplanEntity.setDemandSupplierId(value);
        Example<LandCoalSendplanEntity> of = Example.of(landCoalSendplanEntity);
        List<LandCoalSendplanEntity> all = this.landCoalSendplanRepo.findAll(of);
        List<Map> mapList = new ArrayList();
        Iterator var7 = all.iterator();

        while(var7.hasNext()) {
            LandCoalSendplanEntity le = (LandCoalSendplanEntity)var7.next();
            Map<String, Object> sample = new HashMap();
            sample.put("name", "陆运煤需求下达:" + le.getPurchaseSalePlanId());
            sample.put("value", "下达标煤单价：" + le.getStandardCoalUnitprice());
            this.sendPlan.add(le);
            sample.put("children", this.landTracerBid(le.getPurchaseSalePlanId()));
            mapList.add(sample);
        }

        return mapList;
    }

    private List<Map> landTracerBid(String value) {
        WinBidPriceEntity winBidPriceEntity = new WinBidPriceEntity();
        winBidPriceEntity.setPurchaseSalePlanId(value);
        Example<WinBidPriceEntity> of = Example.of(winBidPriceEntity);
        List<WinBidPriceEntity> all = this.winBidPriceRepo.findAll(of);
        List<Map> mapList = new ArrayList();
        Iterator var7 = all.iterator();

        while(var7.hasNext()) {
            WinBidPriceEntity le = (WinBidPriceEntity)var7.next();
            Map<String, Object> sample = new HashMap();
            sample.put("name", "陆运煤竞价:" + le.getPurchaseSalePreceptId());
            sample.put("value", "中标标煤单价：" + le.getWinBidPrice());
            this.bid.add(le);
            sample.put("children", this.landTracerPurchasePlan(le.getPurchaseSalePreceptId()));
            mapList.add(sample);
        }

        return mapList;
    }

    private List<Map> landTracerPurchasePlan(String value) {
        LandCoalPurchasingplanEntity landCoalPurchasingplanEntity = new LandCoalPurchasingplanEntity();
        landCoalPurchasingplanEntity.setPurchaseSalePreceptId(value);
        Example<LandCoalPurchasingplanEntity> of = Example.of(landCoalPurchasingplanEntity);
        List<LandCoalPurchasingplanEntity> all = this.landCoalPurchasingplanRepo.findAll(of);
        List<Map> mapList = new ArrayList();
        Iterator var7 = all.iterator();

        while(var7.hasNext()) {
            LandCoalPurchasingplanEntity le = (LandCoalPurchasingplanEntity)var7.next();
            Map<String, Object> sample = new HashMap();
            sample.put("name", "陆运煤合同:" + le.getContractId());
            sample.put("value", "合同标煤单价：" + le.getStandardCoalUnitprice());
            this.purchasePlan.add(le);
            sample.put("children", this.landTracerContract(le.getContractId()));
            mapList.add(sample);
        }

        return mapList;
    }

    private List<Map> landTracerContract(String value) {
        LandCoalSettleEntity landCoalSettleEntity = new LandCoalSettleEntity();
        landCoalSettleEntity.setContractId(value);
        Example<LandCoalSettleEntity> of = Example.of(landCoalSettleEntity);
        List<LandCoalSettleEntity> all = this.landCoalSettleRepo.findAll(of);
        List<Map> mapList = new ArrayList();
        Iterator var7 = all.iterator();

        while(var7.hasNext()) {
            LandCoalSettleEntity le = (LandCoalSettleEntity)var7.next();
            Map<String, Object> sample = new HashMap();
            sample.put("name", "陆运煤结算单:" + le.getBalanceId());
            sample.put("value", "结算单标煤单价：" + le.getStandardCoalUnitprice());
            this.contract.add(le);
            sample.put("children", (Object)null);
            mapList.add(sample);
        }

        return mapList;
    }

    private void waterTracerDemand(String value) {
        WaterCoalDemandplanEntity waterCoalDemandplanEntity = new WaterCoalDemandplanEntity();
        waterCoalDemandplanEntity.setDemandSupplierId(value);
        Example<WaterCoalDemandplanEntity> of = Example.of(waterCoalDemandplanEntity);
        List<WaterCoalDemandplanEntity> all = this.waterCoalDemandplanRepo.findAll(of);
        WaterCoalDemandplanEntity sample = (WaterCoalDemandplanEntity)all.get(0);
        this.res.put("name", "下水煤需求计划:" + sample.getDemandSupplierId());
        this.res.put("value", "需求标煤单价：" + sample.getStandardCoalUnitprice());
        this.demandPlan.add(sample);
        this.res.put("children", this.waterTracerSend(value));
    }

    private List<Map> waterTracerSend(String value) {
        WaterCoalSendplanEntity waterCoalSendplanEntity = new WaterCoalSendplanEntity();
        waterCoalSendplanEntity.setDemandSupplierId(value);
        Example<WaterCoalSendplanEntity> of = Example.of(waterCoalSendplanEntity);
        List<WaterCoalSendplanEntity> all = this.waterCoalSendplanRepo.findAll(of);
        List<Map> mapList = new ArrayList();
        Iterator var7 = all.iterator();

        while(var7.hasNext()) {
            WaterCoalSendplanEntity le = (WaterCoalSendplanEntity)var7.next();
            Map<String, Object> sample = new HashMap();
            sample.put("name", "下水煤下达计划:" + le.getPurchaseSalePlanId());
            sample.put("value", "下达标煤单价：" + le.getStandardCoalUnitprice());
            this.sendPlan.add(le);
            sample.put("children", this.waterTracerBid(le.getPurchaseSalePlanId()));
            mapList.add(sample);
        }

        return mapList;
    }

    private List<Map> waterTracerBid(String value) {
        WinBidPriceEntity winBidPriceEntity = new WinBidPriceEntity();
        winBidPriceEntity.setPurchaseSalePlanId(value);
        Example<WinBidPriceEntity> of = Example.of(winBidPriceEntity);
        List<WinBidPriceEntity> all = this.winBidPriceRepo.findAll(of);
        List<Map> mapList = new ArrayList();
        Iterator var7 = all.iterator();

        while(var7.hasNext()) {
            WinBidPriceEntity le = (WinBidPriceEntity)var7.next();
            Map<String, Object> sample = new HashMap();
            sample.put("name", "下水煤竞价:" + le.getPurchaseSalePreceptId());
            sample.put("value", "中标价格：" + le.getWinBidPrice());
            this.bid.add(le);
            sample.put("children", this.waterTracerPurchasePlan(le.getPurchaseSalePreceptId()));
            mapList.add(sample);
        }

        return mapList;
    }

    private List<Map> waterTracerPurchasePlan(String value) {
        WaterCoalPurchasingplanEntity waterCoalPurchasingplanEntity = new WaterCoalPurchasingplanEntity();
        waterCoalPurchasingplanEntity.setPurchaseSalePreceptId(value);
        Example<WaterCoalPurchasingplanEntity> of = Example.of(waterCoalPurchasingplanEntity);
        List<WaterCoalPurchasingplanEntity> all = this.waterCoalPurchasingplanRepo.findAll(of);
        List<Map> mapList = new ArrayList();
        Iterator var7 = all.iterator();

        while(var7.hasNext()) {
            WaterCoalPurchasingplanEntity le = (WaterCoalPurchasingplanEntity)var7.next();
            Map<String, Object> sample = new HashMap();
            sample.put("name", "下水煤合同:" + le.getContractId());
            sample.put("value", "合同标煤单价：" + le.getStandardCoalUnitprice());
            this.purchasePlan.add(le);
            sample.put("children", this.waterTracerContract(le.getContractId()));
            mapList.add(sample);
        }

        return mapList;
    }

    private List<Map> waterTracerContract(String value) {
        WaterCoalSettleEntity waterCoalSettleEntity = new WaterCoalSettleEntity();
        waterCoalSettleEntity.setContractId(value);
        Example<WaterCoalSettleEntity> of = Example.of(waterCoalSettleEntity);
        List<WaterCoalSettleEntity> all = this.waterCoalSettleRepo.findAll(of);
        List<Map> mapList = new ArrayList();
        Iterator var7 = all.iterator();

        while(var7.hasNext()) {
            WaterCoalSettleEntity le = (WaterCoalSettleEntity)var7.next();
            Map<String, Object> sample = new HashMap();
            sample.put("name", "下水煤结算:" + le.getBalanceId());
            sample.put("value", "结算标煤单价：" + le.getStandardCoalUnitprice());
            this.contract.add(le);
            sample.put("children", (Object)null);
            mapList.add(sample);
        }

        return mapList;
    }



}
